package com.tomtaw.web.callnumber;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;

import com.tomtaw.web.callnumber.storage.AppPrefs;

/**
 * 类描述：
 *
 * @version :
 */
public class BootBroadcastReceiver extends BroadcastReceiver {
    public static final String BOOT_LAUNCH = "BOOT_LAUNCH";
    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) &&
                AppPrefs.getSharedBoolean(BOOT_LAUNCH,true)){

            Intent thisIntent = new Intent(context, MainActivity.class);//设置要启动的app
            thisIntent.setAction("android.intent.action.MAIN");
            thisIntent.addCategory("android.intent.category.LAUNCHER");
            thisIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(thisIntent);
        }
    }

}